#include("../../comm/FormHead.html")
<div class="layui-tab layui-tab-brief">
    <ul class="layui-tab-title" style="width: 100%;float:left">
        <li class="layui-this"><i class="layui-icon layui-icon-tabs"></i> #(form.actions=='EDIT'?'编辑':'创建新的')角色</li>
        <li lay-event="SetRoleMenu"><i class="layui-icon layui-icon-list"></i> 角色菜单</li>
        <li lay-event="SetRoleActivity"><i class="layui-icon layui-icon-set-sm"></i> 角色功能</li>
        <li lay-event="SetRoleUser"><i class="layui-icon layui-icon-username"></i> 角色人员</li>
    </ul>
</div>
<div id="main" style="width:60vw">
    <div class="layui-row" style="padding-bottom:5px"></div>
    <form action="" class="layui-form margin-10" lay-filter="form">
        <input type="hidden" id="actions" name="actions" value="#(form.actions)">
        #(token??)
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label">角色ID</label>

                    <div class="layui-input-block">
                        <input type="text" id="role_id" name="role_id" lay-affix="clear" placeholder="请输入角色ID" #(form.actions== 'EDIT'?'readonly':'')
                        value="#(role.role_id)" class="layui-input #(form.actions== 'EDIT'?'input-readonly':'')">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label">角色名称</label>

                    <div class="layui-input-block">
                        <input type="text" id="role_name" lay-affix="clear" name="role_name" placeholder="请输入姓名"
                               lay-affix="clear" value="#(role.role_name)" class="layui-input">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label">显示顺序</label>

                    <div class="layui-input-inline" style="width:100px">
                        <input type="text" lay-skin="mynumber" id="sindex" name="sindex" placeholder=""
                               value="#(role.sindex)" class="layui-input">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label">角色说明</label>

                    <div class="layui-input-block">
                        <textarea name="role_desc" placeholder="请输入内容" class="layui-textarea" style="min-height:120px">#(role.role_desc)</textarea>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="submit" class="layui-btn" lay-submit="" lay-filter="Submit1">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
<SCRIPT LANGUAGE="JavaScript">
    <!--
    layui.use(['form', 'myTool', 'myNumber', 'util'], function () {
        var form = layui.form, $ = layui.$;
        layui.myNumber.render({});

        layui.util.event("lay-event", {
            SetRoleUser: function () {
                if ($("#actions").val() === 'ADD') {
                    layer.msg("请先创建角色");
                    return;
                }
                location.href = "SetRoleUser?role_id=" + $("#role_id").val();
            },
            SetRoleActivity: function () {
                if ($("#actions").val() === 'ADD') {
                    layer.msg("请先创建角色");
                    return;
                }
                location.href = "SetRoleActivity?role_id=" + $("#role_id").val();
            },
            SetRoleMenu: function () {
                if ($("#actions").val() === 'ADD') {
                    layer.msg("请先创建角色");
                    return;
                }
                location.href = "SetRoleMenu?role_id=" + $("#role_id").val();
            }
        });

        form.on('submit(Submit1)', function (data) {
            layui.myTool.postJson('ModifySysRoleApi', data.field, function (results) {
                top.layer.closeAll();
                return false;
            });
            return false;
        });
    });
    //-->
</SCRIPT>
#include("../../comm/Foot.html")
